home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / pcw.zip / WTITLE.C < prev    next >
Text File  |  1990-01-16  |  3KB  |  73 lines

  1. /***********************************************************/
  2. /* File Id.                  Wtitle.C                      */
  3. /* Author.                   Stan Milam.                   */
  4. /* Date Written.             11/13/88.                     */
  5. /* Modifications.                                          */
  6. /*                                                         */
  7. /*           (c) Copyright 1989-90 by Stan Milam           */
  8. /*                                                         */
  9. /* Comments:  This routine will title a window.            */
  10. /***********************************************************/
  11.  
  12. #include <stdio.h>
  13. #include <string.h>
  14. #include "pcw.i"
  15. #include "pcwproto.h"
  16.  
  17. #define  TRUE   1
  18. #define  FALSE  0
  19.  
  20. static int titlefclr = LIGHTGRAY;
  21. static int titlebclr = BLACK;
  22.  
  23. int wtitle(WNDPTR *wnd, int tb, int lrm, char *s) {
  24.  
  25.     int page;
  26.     int col, row;
  27.     int mx_rows, mx_cols;
  28.  
  29.     if (!chk_video_state(&mx_rows, &mx_cols)) return(0);
  30.     if (wnd == NULL) return(0);
  31.     if (wnd->hideflag) return(1);                    /* Return if hidden */
  32.  
  33.     re_order(wnd, NORMAL);
  34.     if (strlen(s) > ((wnd->lcol - wnd->ucol) - 2))
  35.        return(FALSE);
  36.  
  37.     switch(tb) {
  38.         case TOP    : row = wnd->urow; break;
  39.         case BOTTOM : row = wnd->lrow; break;
  40.         default     : row = wnd->urow; break;
  41.     }
  42.  
  43.     switch(lrm) {
  44.         case LEFT   : col = wnd->ucol + 2; break;
  45.         case RITE   : col = (wnd->lcol - strlen(s)) - 1; break;
  46.         default     :
  47.         case MIDDLE : col = (wnd->lcol + wnd->ucol) / 2;
  48.                       col = col - (strlen(s) / 2);
  49.                       break;
  50.     }
  51.  
  52.     page = getpage();                              /* Save current page */
  53.     setpage(wnd->page);                            /* Set for window page */
  54.     qputs(row,col,titlefclr,titlebclr,s);          /* Write the title */
  55.     setpage(page);                                 /* Restore current page */
  56.     return(TRUE);                                  /* and quit */
  57. }
  58.  
  59. /***********************************************************/
  60. /*                       TITLECOLOR()                      */
  61. /*                                                         */
  62. /* This function changes the value of the two static       */
  63. /* variables which determine the title color when wtitle is*/
  64. /* called.                                                 */
  65. /***********************************************************/
  66.  
  67. void titlecolor(int fcolor, int bcolor) {
  68.  
  69.      titlefclr = (fcolor & 0x000f);
  70.      titlebclr = (bcolor & 0x000f);
  71. }
  72.  
  73.